package designpatterns.abstractfactory;

import designpatterns.abstractfactory.intf.Color;
import designpatterns.abstractfactory.intf.Green;
import designpatterns.abstractfactory.intf.Red;
import designpatterns.abstractfactory.intf.Shape;

/**
 * @description:
 * @author: Lidong
 * @time: 2020/7/21 21:42
 **/
public class ColorFactory extends AbstractFactory {

    public static final String TYPE = "color";

    @Override
    public Color getColor(String color) {
        if (color == null) {
            return null;
        } else if (Red.COLOR.equalsIgnoreCase(color)) {
            return new Red();
        } else if (Green.COLOR.equalsIgnoreCase(color)) {
            return new Green();
        }
        return null;
    }

    @Override
    public Shape getShape(String shape) {
        return null;
    }
}
